<html>
<head><meta charset="utf-8"><title>&#x27;rustc&#x27; panicked at &#x27;attempted to read from stolen value&#x27; · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html">&#x27;rustc&#x27; panicked at &#x27;attempted to read from stolen value&#x27;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219145122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219145122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219145122">(Dec 07 2020 at 22:05)</a>:</h4>
<p>I'm getting the error message <code>'rustc' panicked at 'attempted to read from stolen value'</code> when calling :</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">for</span><span class="w"> </span><span class="n">function</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">body_owners</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">mir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">mir_built</span><span class="p">(</span><span class="n">ty</span>::<span class="n">WithOptConstParam</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">did</span>: <span class="nc">function</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">const_param_did</span>: <span class="nc">tcx</span><span class="p">.</span><span class="n">opt_const_param_of</span><span class="p">(</span><span class="n">function</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">});</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">mir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">mir</span><span class="p">.</span><span class="n">borrow</span><span class="p">();</span><span class="w"> </span><span class="c1">// here</span>
</code></pre></div>
<p>For the context, I'm creating a tool that analyze the callgraph of a crate. I forked <code>rustdoc</code>, renamed it <code>cargo-callgraph</code> and then modified the function <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/core/fn.run_global_ctxt.html"><code>run_global_ctxt</code></a>. You can get the code with <code>git clone git@github.com:robinmoussu/cargo-callgraph.git</code>.</p>
<p>When running my tool on a single rust file, or on a simple file, this works perfectly (note: the output is hardcoded to <code>example2.dot</code>, don't ask me why!):</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code><span class="c1"># run on a single file</span>
cargo run -- test/test1/src/main.rs <span class="o">&amp;&amp;</span> dot -Txlib example2.dot

<span class="c1"># run on a simple crate</span>
<span class="nb">cd</span> test/test1 <span class="o">&amp;&amp;</span> <span class="nv">RUSTDOC</span><span class="o">=</span>../../target/debug/cargo-callgraph cargo doc <span class="o">&amp;&amp;</span> dot -Txlib example2.dot
</code></pre></div>
<p>However, if I try to run it on a more complex crate, for example cargo-callgraph itself, I get the error mentioned above</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code>$ <span class="nv">RUSTDOC</span><span class="o">=</span>target/debug/cargo-callgraph cargo doc
thread <span class="s1">'rustc'</span> panicked at <span class="s1">'attempted to read from stolen value'</span>, /rustc/e792288df31636ca28108516c63a00ce4267063a/compiler/rustc_data_structures/src/steal.rs:35:21
</code></pre></div>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_data_structures/steal.rs.html#33-38">Steal::borrow()</a></p>
<p>The function whose mir cannot be borrowed is <code>cargo_callgraph[8787]::formats::item_type::ItemType::Module::{constant#0})</code>, and this function was not previously analyzed (I printed the <code>DefId</code> of every function to check it).</p>
<p>I have no idea of how to debug this.</p>



<a name="219146167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219146167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219146167">(Dec 07 2020 at 22:13)</a>:</h4>
<p>I don't know what's going wrong, but <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/steal/struct.Steal.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/steal/struct.Steal.html</a> might give you some background</p>



<a name="219146252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219146252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219146252">(Dec 07 2020 at 22:14)</a>:</h4>
<p>I think the MIR is stolen for optimizations?</p>



<a name="219146321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219146321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219146321">(Dec 07 2020 at 22:14)</a>:</h4>
<p>You don't have access to debug-level logging, right?</p>



<a name="219146398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219146398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219146398">(Dec 07 2020 at 22:15)</a>:</h4>
<p>Love the docs though</p>
<blockquote>
<p>Specifically, we sometimes have queries (<em>cough</em> MIR <em>cough</em>)</p>
</blockquote>



<a name="219147585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219147585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219147585">(Dec 07 2020 at 22:27)</a>:</h4>
<p>Maybe <code>-Zquery-stats</code> can help you understand which queries get called?</p>



<a name="219147608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219147608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219147608">(Dec 07 2020 at 22:27)</a>:</h4>
<p>Specifically the "Query value count" part</p>



<a name="219147625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219147625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219147625">(Dec 07 2020 at 22:28)</a>:</h4>
<p>You might just access <code>optimized_mir</code> and use <code>-Zmir-opt-level=0</code> to ensure that no optimization will ever remove a function call.</p>



<a name="219147686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219147686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219147686">(Dec 07 2020 at 22:28)</a>:</h4>
<blockquote>
<p>I think the MIR is stolen for optimizations?</p>
</blockquote>
<p>Correct</p>



<a name="219148366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219148366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219148366">(Dec 07 2020 at 22:34)</a>:</h4>
<p>(There's also some documentation about stealing in <a href="https://rustc-dev-guide.rust-lang.org/mir/passes.html#stealing">https://rustc-dev-guide.rust-lang.org/mir/passes.html#stealing</a>)</p>



<a name="219150214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150214">(Dec 07 2020 at 22:55)</a>:</h4>
<p>Step one: ask a question. Step two: take a break, and watch the latest <a href="https://www.youtube.com/watch?v=ZI2Q5cFqx9k">wintergatan</a> video (if you don't know the marble machine he his building, it's definitively worth the watch each week). Step three: come back and get amazing proposition. <span aria-label="stuck out tongue wink" class="emoji emoji-1f61c" role="img" title="stuck out tongue wink">:stuck_out_tongue_wink:</span></p>
<div class="youtube-video message_inline_image"><a data-id="ZI2Q5cFqx9k" href="https://www.youtube.com/watch?v=ZI2Q5cFqx9k"><img src="https://i.ytimg.com/vi/ZI2Q5cFqx9k/default.jpg"></a></div>



<a name="219150543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150543">(Dec 07 2020 at 22:58)</a>:</h4>
<p><span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> why does both <code>-Z query-stats</code> and <code>-Z mir-opt-level</code> are rejected?</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code>$ cargo build <span class="o">&amp;&amp;</span> <span class="nv">RUST_BACKTRACE</span><span class="o">=</span>full <span class="nv">RUSTDOC</span><span class="o">=</span>target/debug/cargo-callgraph cargo doc --no-deps --jobs <span class="m">1</span> -Zmir-opt-level<span class="o">=</span><span class="m">0</span>
    Finished dev <span class="o">[</span>unoptimized + debuginfo<span class="o">]</span> target<span class="o">(</span>s<span class="o">)</span> in <span class="m">0</span>.03s
error: unknown <span class="sb">`</span>-Z<span class="sb">`</span> flag specified: mir-opt-level
</code></pre></div>



<a name="219150609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150609">(Dec 07 2020 at 22:59)</a>:</h4>
<p><span class="user-mention" data-user-id="281841">@Robin Moussu</span> they're being passed to cargo, not to rustdoc</p>



<a name="219150612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150612">(Dec 07 2020 at 22:59)</a>:</h4>
<p>add <code>--</code></p>



<a name="219150729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150729">(Dec 07 2020 at 23:00)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ cargo build &amp;&amp; RUST_BACKTRACE=full RUSTDOC=target/debug/cargo-callgraph cargo doc --no-deps --jobs 1 -- -Zmir-opt-level=0
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
error: Found argument &#39;-Zmir-opt-level=0&#39; which wasn&#39;t expected, or isn&#39;t valid in this context

USAGE:
    cargo doc --jobs &lt;N&gt; --no-deps

For more information try --help
</code></pre></div>



<a name="219150771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150771">(Dec 07 2020 at 23:00)</a>:</h4>
<div class="codehilite"><pre><span></span><code>cargo doc --help
cargo-doc
Build a package&#39;s documentation

USAGE:
    cargo doc [OPTIONS]

OPTIONS:
    -Z &lt;FLAG&gt;...                     Unstable (nightly-only) flags to Cargo, see &#39;cargo -Z help&#39; for details
</code></pre></div>



<a name="219150778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150778">(Dec 07 2020 at 23:00)</a>:</h4>
<p>oh sorry, <code>cargo rustdoc</code>, not <code>cargo doc</code></p>



<a name="219150955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150955">(Dec 07 2020 at 23:02)</a>:</h4>
<p><code>cargo build &amp;&amp; RUST_BACKTRACE=full RUSTDOC=target/debug/cargo-callgraph cargo rustdoc --jobs 1 -- -Zmir-opt-level=0</code> gives me the exact same error <span aria-label="eyes" class="emoji emoji-1f440" role="img" title="eyes">:eyes:</span></p>



<a name="219150994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219150994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219150994">(Dec 07 2020 at 23:02)</a>:</h4>
<p>What is the difference between <code>cargo doc</code> and <code>cargo rustdoc</code>?</p>



<a name="219151796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219151796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219151796">(Dec 07 2020 at 23:12)</a>:</h4>
<p><code>cargo doc</code> is a layer on top of <code>rustdoc</code>, whereas <code>cargo rustdoc</code> gives you more direct access. But I don't fully understand the difference either :)</p>



<a name="219152061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219152061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219152061">(Dec 07 2020 at 23:15)</a>:</h4>
<p>Pff, I need to go to bed, and continue tomorrow. Given that my code isn't stealing anything, I will try to do more clean-up and remove everything but my code (there is currently still some remainders of the original <code>librustdoc</code> around my code). I hope it will help. If anyone has other ideas, I'll gladly read them tomorrow.</p>



<a name="219152175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219152175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219152175">(Dec 07 2020 at 23:16)</a>:</h4>
<p>You can use RUSTDOCFLAGS to pass the flags to rustdoc.</p>



<a name="219152520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219152520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219152520">(Dec 07 2020 at 23:21)</a>:</h4>
<div class="codehilite"><pre><span></span><code>cargo build &amp;&amp; RUSTDOCFLAGS=-Zmir-opt-level=0 RUSTDOC=target/debug/cargo-callgraph cargo doc --jobs 1
</code></pre></div>
<p>It still gives the same error (and I also tested with <code>cargo rustdoc</code> without more success). <span aria-label="sad" class="emoji emoji-2639" role="img" title="sad">:sad:</span></p>



<a name="219153485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219153485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219153485">(Dec 07 2020 at 23:34)</a>:</h4>
<p><span class="user-mention" data-user-id="281841">@Robin Moussu</span>  that sounds like you got rid of some of rustdoc's argument parsing when stripping parts of rustdoc away</p>



<a name="219153540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219153540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219153540">(Dec 07 2020 at 23:35)</a>:</h4>
<p>I don't think so, but will double check tomorrow</p>



<a name="219285538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/%27rustc%27%20panicked%20at%20%27attempted%20to%20read%20from%20stolen%20value%27/near/219285538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Robin Moussu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/&#x27;rustc&#x27;.20panicked.20at.20&#x27;attempted.20to.20read.20from.20stolen.20value&#x27;.html#219285538">(Dec 09 2020 at 00:57)</a>:</h4>
<p>I have no idea what triggered that bug (especially since <code>tcx.is_mir_available(function))</code> returns true), but I realized that <code>tcx.body_owner()</code> doesn't only iterate on functions and closure, but a bunch of other stuff. I filtered them out, and the buggy item was part of what have been filtered out (it was an <code>AnonConst</code>, but not the only one, so go figure).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>